package com.brayan.webapp.service.general.country;

import javax.ejb.Stateless;
import javax.inject.Inject;

import com.brayan.webapp.model.general.country.Country;
import com.brayan.webapp.repository.general.country.CountryRepository;

@Stateless
public class CountryBean {
	
	@Inject
	CountryRepository countryRepoService;
	
	private Country country;

	public Country getCountry() {
		return country;
	}

	public void setCountry(Country country) {
		this.country = country;
	}
	
	/**
	 * Returns the 3-digit country code.
	 * @param countryName
	 * @return
	 */
	public String getCountryCodeByCountryName(String countryName){
		Country country = countryRepoService.findCountryByCountryName(countryName);
		return country.getCountryCode();
	}
	
	
}
